<?php


namespace App\Models;


class AdminUser extends BaseModel
{
    public function checkLogin($request)
    {
        $username = $request['username'];
        $password = $request['password'];
        $adminUser = self::where('username', $username)->first();
        $bool = passwordVerify($password, $adminUser['password']);
        if ($bool) {
            unset($adminUser->password);
            return ['data' => $adminUser, 'status' => 1];
        } else {
            return ['data' => [], 'status' => 0];
        }
    }

    public function shop()
    {
        return $this->hasOne(Shop::class, 'id', 'shop_id');
    }
}